package guowenlong.golf.ui.regist.step_one;

import guowenlong.golf.C;
import guowenlong.golf.entity.VerificationCodeEntity;
import rx.Observer;

/**
 * des   : 描述 author: Gavin email : guowenlong20000@gmail.com time  : 2016年09月13日 下午 6:26.
 */
public class StepOnePresenter extends StepOneContract.Presenter {


  @Override
  public void getCode(String phone) {
    mRxManager.add(mModel.getCode(phone).subscribe(new Observer<VerificationCodeEntity>() {
      @Override
      public void onCompleted() {

      }

      @Override
      public void onError(Throwable e) {

      }

      @Override
      public void onNext(VerificationCodeEntity verificationCodeEntity) {
        if (verificationCodeEntity.getStatus() == C.RESULT_OK) {
          mView.getCodeSuccess(verificationCodeEntity);
        } else if (verificationCodeEntity.getStatus() == C.RESULT_ERROR) {
          mView.getCodeError(verificationCodeEntity);
        }
      }
    }));
  }

  @Override
  public void onStart() {

  }
}